Skip to content

add: automated release flow for widgets/packages, and event dispatch for automated wallet integration trigger - #131

Open
L03TJ3 wants to merge 2 commits into
mainfrom
widget-release-flow
Open

add: automated release flow for widgets/packages, and event dispatch for automated wallet integration trigger#131
L03TJ3 wants to merge 2 commits into
mainfrom
widget-release-flow

Conversation

@L03TJ3

@L03TJ3 L03TJ3 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a guarded production release path for the publishable GoodWidget packages and the wallet-facing widget integration contract that release automation depends on.

Summary

  • add a PR validation workflow plus protected promote-next, release-next, and recover-release workflows for npm publication
  • add release scripts that detect affected production packages, bump authoritative versions on next, rebuild/package them, publish with provenance, verify npm integrity/latest, tag releases, and optionally notify GoodWallet
  • add a v2 widget integration manifest schema plus checked-in integration-manifest.json files for production widgets, with validation for schema shape, package exports, tarball contents, and npm publication metadata
  • make widget ./register entries SSR-safe so Node/Next.js can inspect published packages without eagerly touching DOM globals, and keep web-component dispatch wiring available for wallet automation after a verified release

Operational flow

  1. validate-release.yml runs on PRs that touch release-relevant files and checks the release contract with:
    • pnpm test:release
    • pnpm lint
    • pnpm build
    • pnpm validate:register-entries
  2. A maintainer manually runs Promote main to next. main stays the development/deployment branch; only next is allowed to publish packages.
  3. A push to next triggers Release production packages, which:
    • computes the affected published packages (including transitive consumers)
    • updates package versions and pnpm-lock.yaml
    • lint/builds/tests and verifies SSR-safe ./register exports
    • packs tarballs and checks that required artifacts are present
    • commits the authoritative release versions back to next
    • publishes packages to npm with provenance
    • waits for npm to reflect both the immutable version and the latest dist-tag
    • creates and pushes per-package git tags
    • dispatches widget release payloads to GoodWallet only after npm verification succeeds
  4. If publication is interrupted after version commit, Recover committed npm release republishes or verifies the already-committed version and can replay the post-release wallet dispatch.

Required release environment configuration

Protected release environment configuration expected by these workflows:

  • NPM_TOKEN — required for npm publication
  • GOODWALLET_DISPATCH_PAT — required only when GoodWallet repository dispatch is enabled
  • ENABLE_GOODWALLET_DISPATCH — protected repository/environment variable gate; dispatch remains disabled unless this is explicitly set to true

Additional implementation notes

  • production package metadata is normalized/validated for license, repository source, and public access
  • widget integration manifests are published as package exports so downstream consumers can inspect immutable widget identity and entry points
  • release automation is intentionally topological so shared packages publish before widget consumers
  • CODEOWNERS now requires maintainer review for release workflows, release scripts, schemas, and widget integration manifests

Related work: #132

How Has This Been Tested?

Release-contract validation added in this PR is exercised through:

  • pnpm test:release
  • pnpm lint
  • pnpm build
  • pnpm validate:register-entries

Checklist:

  • PR title matches follow: (Feature|Bug|Chore) Task Name
  • My code follows the style guidelines of this project
  • I have followed all the instructions described in the initial task (check Definitions of Done)
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added reference to a related issue in the repository
  • I have added a detailed description of the changes proposed in the pull request. I am as descriptive as possible, assisting reviewers as much as possible.
  • I have added screenshots related to my pull request (for frontend tasks)
  • I have pasted a gif showing the feature.
  • @mentions of the person or team responsible for reviewing proposed changes

Copilot AI review requested due to automatic review settings July 29, 2026 09:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a production release pipeline for GoodWidget packages/widgets (versioning → build/pack/publish → tag → optional GoodWallet dispatch), and formalizes a widget integration manifest contract validated in CI. It also updates widget register entry points to be SSR-safe by deferring browser-only imports until a Custom Elements runtime is detected.

Changes:

  • Add release tooling (scripts/release/*) plus GitHub Actions workflows to validate, promote, release, and recover npm publications.
  • Introduce a v2 widget integration manifest schema + per-widget integration-manifest.json, and enforce package publication metadata consistency.
  • Make widget register entry points SSR-safe (dynamic element imports + DOM guards) and adjust embed/core/ui packaging details to support safe package inspection.

Reviewed changes

Copilot reviewed 47 out of 48 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/release/validate-register-entries.mjs Validates that every production widget ./register export is SSR-safe for both ESM and CJS builds.
scripts/release/validate-packages.mjs Enforces consistent npm metadata (license, repo, publishConfig) across production packages and checks repository LICENSE.
scripts/release/validate-manifests.test.mjs Adds unit tests for manifest validation and release-envelope creation logic.
scripts/release/validate-manifests.mjs Implements schema + contract validation for widget integration manifests and release-envelope creation.
scripts/release/release.mjs Adds automated versioning, packing, publishing, tagging, verification, and optional GoodWallet dispatch.
scripts/release/packages.test.mjs Tests release relevance and dependency-cascade selection logic for the production allowlist.
scripts/release/packages.mjs Defines the production allowlist + dependency graph and release-relevance rules.
schemas/widget-integration-manifest.schema.json Adds JSON Schema (draft 2020-12) for integration manifest v2.
pnpm-lock.yaml Locks Ajv version and updates workspace protocol ranges used by packages.
packages/ui/src/components-test/Select.tsx Removes an unused Tamagui type import.
packages/ui/src/components-test/Input.tsx Ensures both onChange and onChangeText are forwarded to the input frame.
packages/ui/src/clipboard.ts Removes an unused type definition.
packages/ui/package.json Adds publish metadata (license/repo/files/publishConfig/sideEffects) for release validation.
packages/streaming-widget/src/register.ts Makes web-component registration SSR-safe via DOM guard + dynamic import; switches to async register.
packages/streaming-widget/package.json Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges.
packages/streaming-widget/integration-manifest.json Adds v2 integration manifest for the streaming widget.
packages/staking-migration-widget/src/register.ts Makes registration SSR-safe via DOM guard + dynamic import; switches to async register.
packages/staking-migration-widget/package.json Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges.
packages/staking-migration-widget/integration-manifest.json Adds v2 integration manifest for the staking migration widget.
packages/governance-widget/package.json Adds license field.
packages/goodreserve-widget/src/register.ts Makes registration SSR-safe via DOM guard + dynamic import; switches to async register.
packages/goodreserve-widget/package.json Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges.
packages/goodreserve-widget/integration-manifest.json Adds v2 integration manifest for the goodreserve widget.
packages/embed/src/createMiniAppElement.tsx Avoids hard-failing on missing DOM globals during SSR/package inspection; minor filter cleanup.
packages/embed/package.json Adds publish metadata and updates workspace ranges.
packages/core/src/detect.ts Removes unused type import.
packages/core/package.json Adds publish metadata and updates workspace ranges.
packages/claim-widget-theme-demo/src/register.ts Adds a customElements guard (but still statically imports element, which undermines SSR safety).
packages/claim-widget-theme-demo/package.json Adds license field.
packages/citizen-claim-widget/src/register.ts Makes registration SSR-safe via DOM guard + dynamic import; switches to async register.
packages/citizen-claim-widget/package.json Adds publish metadata, integration-manifest export, sideEffects, bumps stable version, updates workspace ranges.
packages/citizen-claim-widget/integration-manifest.json Adds v2 integration manifest for the citizen claim widget.
packages/ai-credits-widget/src/register.ts Makes registration SSR-safe via DOM guard + dynamic import; switches to async register.
packages/ai-credits-widget/src/chainClient.ts Adjusts mock method signatures (currently diverges from interface parameter lists).
packages/ai-credits-widget/src/backendClient.ts Adjusts mock method signatures (currently diverges from interface parameter lists).
packages/ai-credits-widget/package.json Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges.
packages/ai-credits-widget/integration-manifest.json Adds v2 integration manifest for the AI credits widget.
package.json Adds MIT license, release/validation scripts, and Ajv devDependency.
LICENSE Adds MIT LICENSE text required by release validation.
docs/PACKAGING.md Updates packaging guidance to recommend SSR-safe async register with dynamic element import.
.github/workflows/validate-release.yml Adds CI workflow to validate release contracts (manifests/packages/register entry SSR safety).
.github/workflows/release-next.yml Adds branch-gated npm release workflow (next-only), including optional GoodWallet dispatch.
.github/workflows/recover-release.yml Adds a recovery workflow to republish/verify an already-committed version.
.github/workflows/promote-next.yml Adds a maintainer-gated workflow to promote main → next.
.github/workflows/deploy-storybook.yml Pins actions by SHA and sets minimal permissions.
.github/workflows/deploy-ai-credits-web.yml Pins actions by SHA and sets minimal permissions.
.github/workflows/copilot-setup-steps.yml Pins actions by SHA for deterministic Copilot setup.
.github/CODEOWNERS Adds maintainers as owners for release automation and integration contract files.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (3)

packages/ai-credits-widget/src/chainClient.ts:313

  • MockAiCreditsChainClient.getWithdrawableUsd no longer accepts the buyer parameter, even though the interface requires it. This makes direct calls on the mock type-invalid. Keep the signature consistent and ignore the argument if unused.
  async getWithdrawableUsd(): Promise<string> {
    return '0'
  }

packages/ai-credits-widget/src/backendClient.ts:441

  • MockAiCreditsBackendClient.closeChannel dropped the optional body parameter even though the interface includes it. This makes it harder to use the mock as a drop-in replacement when code passes request bodies.
  async closeChannel(channelId: string): Promise<ChannelOperationResponse> {
    await sleep(MOCK_DELAY_MS)
    return { channelId, action: 'close', bridge: { enabled: true, txHash: '0xmock' } }
  }

packages/ai-credits-widget/src/backendClient.ts:458

  • MockAiCreditsBackendClient.submitOperatorConsent removed the required body parameter, but AiCreditsBackendClient.submitOperatorConsent requires it (and callers pass it). This prevents using the mock directly without retyping it as the interface. Keep the parameter and ignore it if unused.
  async submitOperatorConsent(buyer: string): Promise<OperatorConsentResponse> {
    await sleep(MOCK_DELAY_MS)
    const normalizedBuyer = normalizeAddress(buyer)
    markMockOperatorConsent(normalizedBuyer)

Comment thread scripts/release/validate-manifests.mjs
Comment thread packages/ai-credits-widget/src/chainClient.ts Outdated
Comment thread packages/ai-credits-widget/src/backendClient.ts Outdated
Comment thread packages/claim-widget-theme-demo/src/register.ts Outdated
Comment thread .github/workflows/release-next.yml
@L03TJ3

L03TJ3 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you produce a pull-request description for the changes proposed

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@copilot can you produce a pull-request description for the changes proposed

Updated the PR description with the release flow, required release environment configuration, manifest/SSR packaging changes, and the verification commands.

@L03TJ3

L03TJ3 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Follow up on your comments and resolve:

  • there should be no effective changes to ai-credits-widgets that are not related to supporting the release of the widget or integration in the wallet

Co-authored-by: L03TJ3 <6606028+L03TJ3@users.noreply.github.com>

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@copilot Follow up on your comments and resolve:

  • there should be no effective changes to ai-credits-widgets that are not related to supporting the release of the widget or integration...

Addressed in a2d8ca6.

I reverted the unrelated ai-credits mock signature changes, fixed the SSR-safe lazy import for claim-widget-theme-demo/register, and hardened manifest validation so malformed nested objects fail with a clear error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants